/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.sBean;

import com.aptech.entities.TblComplaint;
import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Winner
 */
@Stateless
public class TblComplaintFacade extends AbstractFacade<TblComplaint> {

    @PersistenceContext(unitName = "Elevation_System_Online-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public TblComplaintFacade() {
        super(TblComplaint.class);
    }
    public List<TblComplaint> getTblComplaintByDateCreated(Date dateStart,Date dateEnd) {
        Query query = em.createNamedQuery("TblComplaint.findByDateCpCreated");
        query.setParameter("dateStart", dateStart);
        query.setParameter("dateEnd", dateEnd);
        return query.getResultList();  
    }
    public List<TblComplaint> getTblComplaintByDateAdjustmented(Date dateStart,Date dateEnd) {
        Query query = em.createNamedQuery("TblComplaint.findByDateCpAdjustmented");
        query.setParameter("dateStart", dateStart);
        query.setParameter("dateEnd", dateEnd);
        return query.getResultList();  
    }
    public List<TblComplaint> getTblComplaintByOrderHasManyComplaint(Date dateStart,Date dateEnd) {
        Query query = em.createNamedQuery("TblComplaint.findByOrderHasManyComplaint");
        //query.setParameter("dateStart", dateStart);
        //query.setParameter("dateEnd", dateEnd);
        return query.getResultList();  
    }
}
